<style>
    .header-font{
        font-size: 20px
    }
    .layui-card .data-all {
        display: flex;
        justify-content: space-between;
        margin-top: 20px;
    }
    .layui-card  .text-style {
        font-size: 16px;
    }
    .header-time{
        margin-left: 20px
    }
    .layadmin-shortcut .shortcut-list  {
        padding: 30px 0;
        display: flex;
        flex-wrap: wrap;
    }
    .layadmin-shortcut .shortcut-list li {
        min-width: 100px;
        margin-bottom: 20px;
        width: 12.5%;
    }

    .layadmin-shortcut .shortcut-list .icon{
        width: 62px;
        height: 62px;
        margin-bottom: 5px;
    }

    .tips {
        float: right;
        padding: 0 10px;
        margin-top: 10px;
        height: 20px;
        line-height: 20px;
        font-size: 12px;
        color: #3A91FB;
        border-radius: 30px;
        border: 1px #3A91FB solid;
        background: #eaf3ff;
    }
    .info_footer {
        text-align: center;
        bottom: 20px;
        left: 40%;
        font-size: 14px;
        color: rgba(112,112,112,1);
        font-weight: 400;
        margin-bottom: 12px;
    }
</style>
<div class="layui-fluid" style="margin-bottom: 100px;margin-top: 10px">
    <div class="layui-card" >
        <div class="layui-card-header">
            <span class="header-font">运营数据</span>
            <span class="header-time">更新时间：<?=$date?></span>
        </div>
    </div>
    <div class="layui-row layui-col-space15">
        <div class="layui-col-sm3">
            <div class="layui-card">
                <div class="layui-card-header">
                    成交订单（笔）
                    <span class="tips">今日</span>
                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?=$data['order_num']['day']?></p>
                    <p>昨日：<span class="text-style"><?=$data['order_num']['yes']?></span>
                        <?=$data['order_num']['diff']?>
                    <div class="data-all">成交订单总量（笔）<div class="text-style"><?=$data['order_num']['total']?></div></div>
                </div>
            </div>
        </div>
        <div class="layui-col-sm3 ">
            <div class="layui-card">
                <div class="layui-card-header">
                    销售金额（元）
                    <span class="tips">今日</span>
                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?=$data['order_amount']['day']?></p>

                    <p>昨日：<span class="text-style"><?=$data['order_amount']['yes']?></span>
                        <?=$data['order_amount']['diff']?>
                    <div class="data-all">销售总额（元）<div class="text-style"><?=$data['order_amount']['total']?></div></div>
                </div>
            </div>
        </div>
        <div class="layui-col-sm3 ">
            <div class="layui-card">
                <div class="layui-card-header">
                    新增会员（人）
                    <span class="tips">今日</span>
                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?=$data['user_num']['day']?></p>
                    <p >昨日：<span class="text-style"><?=$data['user_num']['yes']?></span>
                        <?=$data['user_num']['diff']?>
                    <div class="data-all">会员总量（人）<div class="text-style"><?=$data['user_num']['total']?></div></div>
                </div>
            </div>
        </div>
        <div class="layui-col-sm3 ">
            <div class="layui-card">
                <div class="layui-card-header">
                    校区数量（个）
                    <span class="tips">今日</span>
                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?=$data['campus']['day']?></p>
                    <p>昨日：<span class="text-style"><?=$data['campus']['yes']?></span>
                        <?=$data['campus']['diff']?>
                    <div class="data-all">总校区数量（个）<div class="text-style"><?=$data['campus']['total']?></div></div>
                </div>
            </div>
        </div>
        <div class="layui-col-sm3 ">
            <div class="layui-card">
                <div class="layui-card-header">
                    跑腿数量（人）
                    <span class="tips">今日</span>
                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?=$data['running_num']['day']?></p>
                    <p>昨日：<span class="text-style"><?=$data['running_num']['yes']?></span>
                        <?=$data['running_num']['diff']?>
                    <div class="data-all">总跑腿数量（人）<div class="text-style"><?=$data['running_num']['total']?></div></div>
                </div>
            </div>
        </div>
        <div class="layui-col-sm3 ">
            <div class="layui-card">
                <div class="layui-card-header">
                    跑腿佣金（元）
                    <span class="tips">今日</span>
                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?=$data['running_amount']['day']?></p>
                    <p>昨日：<span class="text-style"><?=$data['running_amount']['yes']?></span>
                        <?=$data['running_amount']['diff']?>
                    <div class="data-all">总跑腿佣金（元）<div class="text-style"><?=$data['running_amount']['total']?></div></div>
                </div>
            </div>
        </div>
        <div class="layui-col-sm3 ">
            <div class="layui-card">
                <div class="layui-card-header">
                    分销数量（人）
                    <span class="tips">今日</span>
                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?=$data['dis_num']['day']?></p>
                    <p>昨日：<span class="text-style"><?=$data['dis_num']['yes']?></span>
                        <?=$data['dis_num']['diff']?>
                    <div class="data-all">总分销数量（人）<div class="text-style"><?=$data['dis_num']['total']?></div></div>
                </div>
            </div>
        </div>
        <div class="layui-col-sm3 ">
            <div class="layui-card">
                <div class="layui-card-header">
                    分销佣金（元）
                    <span class="tips">今日</span>
                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?=$data['dis_amount']['day']?></p>
                    <p>昨日：<span class="text-style"><?=$data['dis_amount']['yes']?></span>
                        <?=$data['dis_amount']['diff']?>
                    <div class="data-all">总分销佣金（元）<div class="text-style"><?=$data['dis_amount']['total']?></div></div>
                </div>
            </div>
        </div>
        <!--表格-->
        <div class="layui-col-sm12">
            <div class="layui-card">
                <div class="layui-card-header">
                    <i class="fa fa-line-chart icon"></i>近15天营业额（元）
                    <input type="text" id="test6" class="form-control" placeholder="请选择时间" autocomplete="off" style="display: inline-block;width: 25%">
                    <a class="btn btn-primary btn-rounded btn-sm" onclick="exsearch()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                </div>
                <div class="layui-card-body">
                    <div class="layui-row">
                        <div class="layadmin-dataview">
                            <div id="sale-charts" style="width: 100%; height: 400px">
                                <div><i class="layui-icon layui-icon-loading1 layadmin-loading"></i></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<footer class="info_footer">
    <?=$copyright?>
    <a target="_blank" href="<?=$record_no_link?>"><?=$record_no?></a>
    <br><br>
</footer>
<script src="/public/static/admin/echarts.common.js"></script>
<?php $this->beginBlock('script'); ?>
<script>
    //15天营业额
    function turnover(result) {
        var data = result.data;
        var option = {
            xAxis: {
                type: 'category',
                data: data.xAxis
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross'
                }
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    data: data.series,
                    type: 'line',
                    smooth: true
                }
            ]
        };
        var myChart = echarts.init(document.getElementById('sale-charts'));
        myChart.setOption(option);
    }
    getData('','')
    function getData(start,end) {
        var config = {
            url: "<?=\yii\helpers\Url::to(['index/turnover'])?>",
            type: "get",
            dataType: "json",
            data: {start_time:start,end_time:end},
            success: function(result) {
                turnover(result)
            }
        };
        $.ajax(config)
    }
    function exsearch() {
        var time = $('#test6').val()
        var start = '';
        var end = '';
        if (time){
            var arr = time.split("/");
            start = arr[0]
            end = arr[1]
        }
        getData(start,end)
    }
    layui.use('laydate', function() {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#test6'
            ,range: '/'
            ,max:'<?=$time?>'
            ,trigger: 'click'
        });
    });
</script>
<?php $this->endBlock(); ?>
